
const GameUtils = {

    MockOpenId() {
        let str: string;
        str = cc.sys.localStorage.getItem('openId');
        if (str) {
            return str;
        } else {
            str = this.randomStr();
            cc.sys.localStorage.setItem('openId', str);
        }
        return str;
    },
    randomStr() {
        let str = Date.now().toString(36);

        for (let i = 0; i < 7; i++) {
            str += Math.ceil(Math.random() * (10 ** 4)).toString(36);
        }

        return str;
    },

    MockPlayerName(): string {
        let outString: string = '';
        let inOptions: string = 'abcdefghijklmnopqrstuvwxyz';
        for (let i = 0; i < 6; i++) {
            outString += inOptions.charAt(Math.floor(Math.random() * inOptions.length));
        }
        return outString;
    },

    /**
    * 显示log
    * @param logStr
    */
    Log(logStr: string) {
        return cc.log(logStr);
    }
}

export default GameUtils;
